import request from '@/utils/request'

const api_name = '/admin/like'

// 分页查询点赞记录
export const GetLikePageList = (page, limit, likeDto) => {
  return request({
    url: `${api_name}/${page}/${limit}`,
    method: 'get',
    params: likeDto,
  })
}

// 添加点赞
export const SaveLike = like => {
  return request({
    url: `${api_name}/save`,
    method: 'post',
    data: like,
  })
}

// 取消点赞
export const RemoveLike = id => {
  return request({
    url: `${api_name}/remove/${id}`,
    method: 'delete',
  })
}

// 查询点赞状态
export const CheckLikeStatus = (userId, targetType, targetId) => {
  return request({
    url: `${api_name}/checkLikeStatus/${userId}/${targetType}/${targetId}`,
    method: 'get',
  })
}

// 获取用户的点赞列表
export const GetUserLikes = userId => {
  return request({
    url: `${api_name}/findUserLikes/${userId}`,
    method: 'get',
  })
}

// 获取目标的点赞列表
export const GetTargetLikes = (targetType, targetId) => {
  return request({
    url: `${api_name}/findTargetLikes/${targetType}/${targetId}`,
    method: 'get',
  })
}
